package com.ttg.pojo;

//~--- non-JDK imports --------------------------------------------------------

//~--- JDK imports ------------------------------------------------------------

//~--- classes ----------------------------------------------------------------


import com.ttg.utils.DataUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Class SyncInfoDTO
 * Description 与SDK传输信息DTO
 *
 * @param <T>
 * Create 2015-10-20 10:36:11
 * @author Ardy
 */
public class SyncInfoDTO<T> {


    private String status;


    private String message;

    private boolean flag;

    private List<T> data;

    public SyncInfoDTO() {
        this.flag   = false;
        this.status = "SUCCESS";
    }


    @Override
    public String toString() {
        return "SyncInfoDTO{" + "status='" + status + '\'' + ", message='" + message + '\'' + ", flag=" + flag
                + ", data=" + data + '}';
    }


    public String getMessage() {
        return message;
    }


    public void setMessage(String message) {
        this.message = message;
        this.status  = "ERROR";
    }


    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public String getStatus() {
        return status;
    }


    public void setStatus(String status) {
        this.status = status;
    }


    public List<T> getData() {
        return data;
    }


    public void setData(List<T> data) {

        if (!DataUtil.isEmpty (data)) {
            this.data = data;
            this.flag = true;
        }
    }


    public void setData(T data) {
        if (!DataUtil.isEmpty (data)) {
            if (null == this.data) {
                this.data = new ArrayList<T>();
            }
            this.data.add(data);
            this.flag = true;
        }
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
